<?php


namespace App\Models\CarModels;


use App\Models\Landscaping\TaskCategory;
use App\Models\SystemManagement\Employee;
use Illuminate\Database\Eloquent\Model;

class PatrolTask extends Model
{
    protected $table = 'patrol_task';
    protected $fillable = ['id','patrol_address','task_type','task_type_second','employee','car','body','patrol_tool','clean','speed','major','score','opinion','voice','other','task_level','status','task_summary','task_body','type'];
    public function type()
    {
        return $this->belongsTo(TaskCategory::class,'task_type');
    }
    public function type_second()
    {
        return $this->belongsTo(TaskCategory::class,'task_type_second');
    }
    public function employee()
    {
        return $this->belongsTo(Employee::class,'employee')->select('id','name','department_id')->with('department');
    }
    function file()
    {
        return $this->hasMany(PatrolImg::class,'patrol_task_id','id')->with('files');
    }
//    public function car()
//    {
//        return $this->belongsTo(CarInfo::class,'car');
//    }
}
